
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>订单管理</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Cache-Control" content="no-transform">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="style/css/basic.css" />
		<link rel="stylesheet" href="style/css/agent_order.css" />
		<script type="text/javascript" src="style/plugin/mui/js/mui.min.js"></script>
		<script type="text/javascript" src="style/js/jquery-1.8.3.min.js" ></script>
		<script type="text/javascript" src="style/js/vue.min.js"></script>
		<script type="text/javascript" src="style/js/vue-resource.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
	</head>

	<body>
		<div id="int_order">
			<!--header-->
			<div id="header">
				<h1>订单管理</h1>
				<span class="backicon"></span>
			</div>
			<!--content-->
			<div class="body">
				<div class="tab">
					<ul class="top clearfix tab33">
						<li :class="{clickStyle:flag==0}" @tap="selall()">
							<a href="javascript:;" >全部</a>
						</li>
				
						<li :class="{clickStyle:flag==1}" @tap="selsend()">
							<a href="javascript:;" >待发货</a>
						</li>
						<li :class="{clickStyle:flag==2}" @tap="selrec()">
							<a href="javascript:;">待收货</a>
						</li>
					</ul>
					<div class="tabcontent">
						<div v-if="flag==0">
							<div class="order_list" v-for="(allo,index) in allorder" v-if="allorder!=''">
								<div class="row">
									<div class="col order-id">
										<div class="row row-align">
											<div class="ellipsis">
												<span>订单号 {{allo.order_no}}</span></div>
											<div class="store-icons"></div>
										</div>
									</div>
									<div class="col order-txt text_color">{{allo.status==0?"待发货":"待收货"}}</div>
								</div>
								<div class="product_wrap">
									<div class="item-row row" v-for="item in allo.good_list">
										<img :src="htp+item.thumb_pic">
										<div class="title">{{item.title}}</div>
										<div class="price">
											<div>{{item.price}}</div>
											<div style="color: #999;">x<em>{{item.num}}</em></div>
										</div>
									</div>
								</div>
								<div class="row">
									<div class="col status-span">
										<span style="color: #999;">共 {{allo.num}}件</span>
										<span style="color: #999;">合计积分</span>
										<span>{{allo.price}}</span>
									</div>
								</div>
								<div class="status-navigator" v-if="allo.status==1">
									<div class="box box-rl">
										<div class="status-btn-red" @tap="ensureRec(index)">确认收货</div>
									</div>
								</div>
							</div>
	
						</div>
						
						<div v-if="flag==1">
							<div class="order_list" v-for="(wait,index) in waitsend" v-if="waitsend!=''">
								<div class="row">
									<div class="col order-id">
										<div class="row row-align">
											<div class="ellipsis">
												<span>订单号 {{wait.order_no}}</span></div>
											<div class="store-icons"></div>
										</div>
									</div>
									<div class="col order-txt text_color">待发货</div>
								</div>
								<div class="product_wrap">
									<div class="item-row row" v-for="item in wait.good_list">
										<img :src="htp+item.thumb_pic">
										<div class="title">{{item.title}}</div>
										<div class="price">
											<div>{{item.price}}</div>
											<div style="color: #999;">x<em>{{item.num}}</em></div>
										</div>
									</div>
								</div>
								<div class="row">
									<div class="col status-span">
										<span style="color: #999;">共 {{wait.num}}件</span>
										<span style="color: #999;">合计积分</span>
										<span>{{wait.price}}</span>
									</div>
								</div>
							</div>
						</div>
						<div v-if="flag==2">
							<div class="order_list" v-for="(waitrec,index) in waitreceive" v-if="waitreceive!=''">
								<div class="row">
									<div class="col order-id">
										<div class="row row-align">
											<div class="ellipsis">
												<span>订单号 {{waitrec.order_no}}</span></div>
											<div class="store-icons"></div>
										</div>
									</div>
									<div class="col order-txt text_color">待收货</div>
								</div>
								<div class="product_wrap">
									<div class="item-row row" v-for="item in waitrec.good_list">
										<img :src="htp+item.thumb_pic">
										<div class="title">{{item.title}}</div>
										<div class="price">
											<div>{{item.price}}</div>
											<div style="color: #999;">x<em>{{item.num}}</em></div>
										</div>
									</div>
								</div>
								<div class="row">
									<div class="col status-span">
										<span style="color: #999;">共 {{waitrec.num}}件</span>
										<span style="color: #999;">合计积分</span>
										<span>{{waitrec.price}}</span>
									</div>
								</div>
								<div class="status-navigator">
									<div class="box box-rl">
										<div class="status-btn-red" @tap="ensureRec(index)">确认收货</div>
									</div>
								</div>
							</div>
						</div>
					</div>
	
				</div>
	
			</div>
		</div>
        <script>
        	new Vue({
        		el:"#int_order",
        		data:{
        			allorder:"",
        			waitsend:"",
        			waitreceive:"",
        			flag:0,
        			htp:"",
        			ord:"",
        			ticket:"",
        			sign:""
        		},
        		methods:{
        			selall:function(){
        				this.flag=0;
        			},
        			selsend:function(){
        				this.flag=1;
        			},
        			selrec:function(){
        				this.flag=2;
        			},
        			ensureRec:function(eIndex){
        				this.flag==0?this.ord=this.allorder:this.ord=this.waitreceive
        				this.$http.post(domain+"/score_order/confirm?t="+this.ticket+"&sign="+this.sign,{
							order_no:this.ord[eIndex].order_no,
							good_no:this.ord[eIndex].good_list[0].good_no
						},{emulateJSON:true}).then(
				            function (res) {
				                // 处理成功的结果
				                if(res.body.code==1){
				                  console.log(res.body)	
				                  mui.toast("收货成功")
				                } 
				            },function (res) {
				            // 处理失败的结果 
				            console.log(res) 
				            }
				        );
        			}
        		},
        		created:function(){
        			this.ticket=localStorage.getItem("tick")
                    this.sign=localStorage.getItem("sig")
                    this.htp=domain2
        			this.$http.post(domain+"/score_order/getList?t="+this.ticket+"&sign="+this.sign,{
						page_id:1
					},{emulateJSON:true}).then(
			            function (res) {
			                // 处理成功的结果
			                if(res.body.code==1){
			                  console.log(res.body)	
			                  this.allorder=res.body.data.list;
			                } 
			            },function (res) {
			            // 处理失败的结果 
			            console.log(res) 
			            }
			        ); 
			        this.$http.post(domain+"/score_order/getList?t="+this.ticket+"&sign="+this.sign,{
						page_id:1,
						status:0
					},{emulateJSON:true}).then(
			            function (res) {
			                // 处理成功的结果
			                if(res.body.code==1){
			                  console.log(res.body)	
			                  this.waitsend=res.body.data.list;
			                } 
			            },function (res) {
			            // 处理失败的结果 
			            console.log(res) 
			            }
			        ); 
			        this.$http.post(domain+"/score_order/getList?t="+this.ticket+"&sign="+this.sign,{
						page_id:1,
						status:1
					},{emulateJSON:true}).then(
			            function (res) {
			                // 处理成功的结果
			                if(res.body.code==1){
			                  console.log(res.body)	
			                  this.waitreceive=res.body.data.list;
			                } 
			            },function (res) {
			            // 处理失败的结果 
			            console.log(res) 
			            }
			        );
        		}
        	})
        </script>
	</body>
	

</html>